/**
 * 解析get参数封装成对象返回
 */
export default function urlParse(){
    let params:any = {};
    if(window.location == null){
        return params;
    }
    
    let name, value, arr:string[];
    let str = window.location.href;
    let num = str.indexOf('?');

    str = str.substr(num+1);
    arr = str.split('&');

    arr.map(item => {
        num = item.indexOf('=');
        if(num > 0){
            name = item.substring(0, num);
            value = item.substring(num + 1);
            params[name] = value;
        }
    });

    return params;
}





